package com.dps.omc.utils.server;

import com.dps.omc.agent.queue.consumer.tasker.utils.JschClient;
import com.jcraft.jsch.JSchException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * Created by DXH on 2016/5/23.
 */
@Service
public class UnixTest extends ServerService {
    private static final Logger logger = LoggerFactory.getLogger(UnixTest.class);

    @Override
    public boolean testConnect(ServerConnect serverConnect) {

        String host = serverConnect.getHost();
        String user = serverConnect.getUser();
        String pass = serverConnect.getPass();

        JschClient client = new JschClient(user,pass,host);
        try {
            client.connect();
            return true;
        } catch (JSchException e) {
            return false;
        }
    }

}
